<?php
$plugin->load_plugin_lang();

$tpl = new Template_plugin('course/plugin/drag_and_drop/templates/result.tpl');

$score = retrieve(POST,'result', '');
$total = retrieve(POST,'total', '');

if($score == '') $score=0;

$percentage = ($score / $total) * 100;
$percentage = number_format($percentage,2);

$tpl->assign_vars(array(
	'SCORE'=>$score,
	'TOTAL'=>$total,
	'PERCENTAGE'=>$percentage,
));


$tpl->parse();

$plugin->save_score($percentage, $module_lp->get_module_id(), $_SERVER['PHP_SELF'], null);